home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 90 / CD Actual 90.iso / Software3D / K-3D / k3d-0.4.2.1 / share / doc / lsystem.txt
Encoding:
Text File  |  2004-07-23  |  8.3 KB  |  159 lines

  1.  
  2. The L-system parser is based on Laurens Lapre source code.
  3. Web page: http://home.wanadoo.nl/laurens.lapre/lparser.htm
  4.  
  5. The source code may be freely distributed, as as stated in above page:
  6.  
  7. "Source code of the lparser ZIP file (18Kb) can also be downloaded,
  8. for those who want to port or just play with new options. The code
  9. is straight, no frills ANSI-C with even less documentation but it
  10. should run on pretty much anything with a C or C++ compiler. My
  11. current job will leave me with neither the time nor the inclination
  12. to do serious code hacking so I'm throwing the code into the wind,
  13. hoping that it will germinate and produce lots of mutated offspring !
  14. The Lparser source may be freely distributed."
  15.  
  16. The L-System example files are from the LParser package available
  17. from the same website.
  18.  
  19. Here is a sample of the documentation that applies to borrowed code:
  20.  
  21.  
  22. More info ... 
  23. ---------------------------------------------------------------------------
  24. The book 'Evolutionary Art and Computers' by S. Todd and W. Latham was used 
  25. to base the genetic 3d form mutation principles on. In here you'll find a lot 
  26. of interesting ideas on how to 'grow' and 'evolve' organic looking 3d forms 
  27. of your own. ISBN 0-12-437185-X
  28.  
  29. The implemented l-system is based on the one described in the book : 'The 
  30. Algorithmic Beauty of Plants' (ABOP) by P. Prusinkiewicz and A. Lindenmayer 
  31. (this is where the 'L' from l-systems come from). If you want more 
  32. information on making your own l-systems you'll want to check out this book. 
  33. A lot can be done by changing the l-systems suplied with the parser and 
  34. seeing for yourself what changes in the final form. ISBN 0-387-97297-8
  35.  
  36.  
  37. Syntax and movement
  38. ---------------------------------------------------------------------------
  39. For those who are already familiar with l-systems, here are the commands and 
  40. their functions for this lparser's 'dialect'. All commands are 1 char only 
  41. and simpler then for most lparsers. This is to keep them from getting 
  42. 'broken' by the mutation process and speeds up the parsing.
  43.  
  44. There is also the posibilty to add an argument to a command. Instead
  45. off doing +++ one can do +(30) if the basic angle was 10 degrees. The 
  46. argument can be a real value.
  47.  
  48. The tropism command will allow you to let gravity pull branches downward by 
  49. adding a 't' element togeter with and 'F'. See the file 'tropism.ls' and 
  50. 'tree*.ls' for examples. When you are not sure about the current 'down' 
  51. direction do a '$' command first. This will roll the turtle horizontal and 
  52. make sure the current up vector is oriented in the positive z-axis direction.
  53.  
  54. The turtle will start at the origin with the Z-axis as forward direction and 
  55. Y-axis as left direction. See the file 'axis.ls' for an detailed example. 
  56. Here you can experiment with the basic orientations and see how the 3d 
  57. turtle is using a 'right-handed' coordinate system. Use your right hand with 
  58. your thumb as up, forefinger as forward and an other finger as left 
  59. direction. 
  60.  
  61. By adding &(90) in front of an axiom the turtle axis will align with the 
  62. right handed coordinate system used in the viewer. Adding an additional
  63. +(90) will make it easier when working with 2d l-systems. See the
  64. 'fract*.ls' files for examples.
  65.  
  66. Values can have some randomness automaticly added to them. Using ~(xx) will 
  67. now add a random direction component to the current orientation with maximum 
  68. of xx in all three directions. This way you can mark at which locations in 
  69. your l-system 'jitter' needs to be introduced. Using this option no two 
  70. 'intances' of the same l-system will look the same. See fern.ls for an 
  71. example.
  72.  
  73.  
  74. ---------------------------------------------------------------------------
  75.  Turtle Orientation commands                                         
  76. ---------------------------------------------------------------------------
  77.  +     turn left around up vector                        
  78.  +(x)  turn x left around up vector                     
  79.  -     turn right around up vector                     
  80.  -(x)  turn x right around up vector                  
  81.  &     pitch down around left vector                 
  82.  &(x)  pitch x down around left vector              
  83.  ^     pitch up around left vector                 
  84.  ^(x)  pitch x up around left vector              
  85.  <     roll left (counter clockwise) around forward vector 
  86.  <(x)  roll x left around forward vector                  
  87.  >     roll right (clockwise) around forward vector      
  88.  >(x)  roll x right around forward vector               
  89.  
  90. ---------------------------------------------------------------------------
  91.  Special Orientation commands                          
  92. ---------------------------------------------------------------------------
  93.  |     turn 180 deg around up vector                  
  94.  %     roll 180 deg around forward vector            
  95.  $     roll until horizontal                        
  96.  ~     turn/pitch/roll in a random direction       
  97.  ~(x)        "     in a random direction with a maximum of x degrees
  98.  t     correction for gravity with 0.2                             
  99.  t(x)  correction for gravity with x                              
  100.  
  101. ---------------------------------------------------------------------------
  102.  Movement commands                          when {} active       
  103. ---------------------------------------------------------------------------
  104.  F     move forward and draw full length    record vertex       
  105.  F(x)  move x forward and draw              record vertex      
  106.  Z     move forward and draw half length    record vertex     
  107.  Z(x)  move x forward and draw              record vertex    
  108.  f     move forward with full length        record vertex   
  109.  f(x)  move x forward                       record vertex  
  110.  z     move forward with half length        record vertex 
  111.  z(x)  move x forward                       record vertex
  112.  g     move forward with full length        don't record vertex 
  113.  g(x)  move x forward                       don't record vertex
  114.  .     don't move                           record vertex     
  115.  
  116. ---------------------------------------------------------------------------
  117.  Structure commands                                         
  118. ---------------------------------------------------------------------------
  119.  [     push current state                                  
  120.  ]     pop current state                                  
  121.  {     start polygon shape                               
  122.  }     end polygon shape                                
  123.  
  124. ---------------------------------------------------------------------------
  125.  Inc/Dec commands                                      
  126. ---------------------------------------------------------------------------
  127.  "     increment length with 1.1                             
  128.  '     decrement length with 0.9                            
  129.  "(x)  multiply length with x also '(x)                    
  130.  ;     increment angle with 1.1                           
  131.  :     decrement angle with 0.9                          
  132.  :(x)  multiply angle with x also ;(x)                  
  133.  ?     increment thickness with 1.4                    
  134.  !     decrement thickness with 0.7                   
  135.  ?(x)  multiply thickness with x also !(x)           
  136.  
  137. ---------------------------------------------------------------------------
  138.  Additional commands                                
  139. ---------------------------------------------------------------------------
  140.  c     increment color index                       
  141.  c(x)  set color index to x                       
  142.  @     end of object                             
  143. ---------------------------------------------------------------------------
  144.  
  145.  
  146. Disclaimer copyrights the software to RenderStar Tecyhnology BV, but tells
  147. nothing about either documentation or sample files; neither RenderStar nor
  148. Laurens Lapre could be contacted, so files are assumed freely distributable
  149. for any purpose:
  150.  
  151. This software is free and may be freely distributed, but is copyrighted by 
  152. the company RenderStar Technology BV. This software is provided as is 
  153. without any guarantees. The author and company assume no liability for 
  154. damages, direct or consequential, which may result from the use of this 
  155. software. The 'lparser.exe' file may not be used as part of any commercial 
  156. package without the explicit written consent of the author or company.
  157.  
  158.  
  159.